package com.ling.pl.security.view.role.url;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.Expose;
import com.ling.pl.security.feign.DefaultRoleService;
import com.ling.pl.security.feign.DefaultUrlService;
import com.ling.pl.security.model.DefaultUrlVO;
import com.ling.pl.security.view.role.RoleMaintain;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * @author bo.wang
 * @since 2013-2-17
 */
@Component("ling2.roleUrlMaintain")
public class RoleUrlMaintain extends RoleMaintain {
    @Resource
    DefaultRoleService roleService;
    @Resource
    private DefaultUrlService urlService;

    @DataProvider
    public List<DefaultUrlVO> loadUrls(String parentId, String roleId) throws Exception {
        List<DefaultUrlVO> urls = this.roleService.loadUrls(parentId, roleId);
        return urls;
    }

    @Expose
    public void saveRoleUrls(String roleId, Collection<String> ids) throws Exception {
        roleService.saveRoleUrls(roleId, ids);
    }
}
